home *** CD-ROM | disk | FTP | other *** search
/ com!online 2005 May / com_0505_1.iso / opensource / top10 / amc_install.exe / {app} / Scripts / CDUniverse.ifs < prev    next >
Encoding:
Text File  |  2004-03-20  |  3.2 KB  |  84 lines

  1. // GETINFO SCRIPTING
  2. // CDUniverse (Quick Picture Grab)
  3.  
  4. (**************************************************
  5.  *  Movie importation script for:                  *
  6.  *      CDUniverse - www.cduniverse.com            *
  7.  *                                                 *
  8.  *  (c) 2003 NoFiX                                 *
  9.  *                                                 *
  10.  *  For use with Ant Movie Catalog 3.4.2           *
  11.  *  www.antp.be/software/moviecatalog              *
  12.  *                                                 *
  13.  *  This program is free software; you can         *
  14.  *  redistribute it and/or modify it under the     *
  15.  *  terms of the GNU General Public License as     *
  16.  *  published by the Free Software Foundation;     *
  17.  *  either version 2 of the License, or (at your   *
  18.  *  option) any later version.                     *
  19. ***************************************************)
  20.  
  21. program CUPictureGrab;
  22. var
  23.   MovieName: string;
  24.  
  25. procedure AnalyzePage(Address: string);
  26. var
  27.   strPage, MovieAddr, MovieTitle, MovieDate, MovieID: string;
  28.   BeginPos, EndPos: Integer;
  29. begin
  30.   strPage := GetPage(Address);
  31.   BeginPos := Pos('<b>Click price', strPage);
  32.   if(BeginPos > -1)then
  33.     begin
  34.       PickTreeClear;
  35.       PickTreeAdd('Search Results for: ' + MovieName, '');
  36.       Delete(strPage, 1, BeginPos);
  37.       BeginPos := Pos('<a href="/productinfo.asp?', strPage);
  38.       EndPos := 1;
  39.       while ((BeginPos > 0) and (EndPos > 0)) do
  40.         begin
  41.           Delete(strPage, 1, BeginPos + 29);
  42.           EndPos := Pos('cart=', strPage) - 1;
  43.           MovieId := Copy(strPage, 1, EndPos - 1);
  44.           MovieAddr := 'http://www.cduniverse.com/productinfo.asp?pid=' + MovieId + '&cart=0&style=movie';
  45.           BeginPos := Pos('<b>', strPage) + 3;
  46.           EndPos := Pos('</b>', strPage);
  47.           MovieTitle := Copy(strPage, BeginPos, EndPos - BeginPos);
  48.           PickTreeAdd(MovieTitle, MovieAddr);
  49.           BeginPos := Pos('<a href="/productinfo.asp?', strPage);
  50.           if(Pos('</table>', strPage) < BeginPos) then
  51.            BeginPos := -1;
  52.         end;
  53.       if(PickTreeExec(Address)) then
  54.         begin
  55.           strPage := GetPage(Address);
  56.           if(Pos('default_coverart.gif', strPage) = 0) then
  57.             begin
  58.               BeginPos := Pos('<img src="http://cover', strPage) + 9;
  59.               Delete(strPage, 1, BeginPos);
  60.               EndPos := Pos('" border=', strPage) - 1;
  61.               //ShowMessage(Copy(strPage, 1, EndPos));
  62.               Address := Copy(strPage, 1, EndPos);
  63.               GetPicture(Address, false);
  64.             end
  65.           else
  66.             ShowMessage('Sorry, no cover-art was found for ' + MovieName);
  67.         end;
  68.     end;
  69. end;
  70.  
  71. begin
  72.   if CheckVersion(3,4,2) then
  73.   begin
  74.     MovieName := GetField(fieldOriginalTitle);
  75.     if MovieName = '' then
  76.       MovieName := GetField(fieldTranslatedTitle);
  77.     if Input('CDUniverse Import', 'Enter the title of the movie:', MovieName) then
  78.     begin
  79.       AnalyzePage('http://www.cduniverse.com/sresult.asp?cart=123456789&style=movie&HT_Search_Info=' + UrlEncode(MovieName));
  80.     end;
  81.   end else
  82.     ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.4.2)');
  83. end.
  84.